<%--
  Created by IntelliJ IDEA.
  User: qjqe@outlook.com
  Date: 2020/5/15
  Time: 9:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@page import="java.util.List"%>
<script>
    //重新刷新
    function reload() {
        location.reload();
    }
    function choessc(a){
        //$("#report").css("display","none");
        //$("#form").attr('style','display:inline')


        $.ajax(
            {
                url: "/course/choess",
                type: "post",
                datatype:"json",
                data:{"id":a},
                success: function (result) { //返回的结果自动放在resut里面了
                    if (result.status == "success") {//请求成功
                        alert("成功");
                        location.reload();
                    } else {
                        alert("失败");
                        location.reload();
                    }
                }
            });
    }


</script>
<div id="report">
<h2 class="sub-header">课程列表</h2>
<div class="table-responsive">
    <table class="table table-striped">
        <thead>
        <tr>
            <th>编号</th>
            <th>课程名字</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items = "${requestScope.course }" var="course">
            <tr>
                <td >${course.courseid }</td>
                <td >${course.coursename }</td>
                <th><button class="btn btn-default delete" onclick="choessc(${course.courseid })">选择</button></th>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
</div>
</div>
